    <form action="" {ife 'commission.level' $level}action="" method="post"{/if}  class="form-horizontal form-validate" enctype="multipart/form-data">
        <input type="hidden" name="id" value="{$level['id']}" />
		 <input type="hidden" name="r" value="commission.level.{if empty($level['id'])}add{else}edit{/if}" />
      <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button data-dismiss="modal" class="close" type="button">×</button>
                <h4 class="modal-title">{if !empty($level['id'])}编辑{else}添加{/if}分销商等级</h4>
            </div>
            <div class="modal-body">
				{if $leveltype==11 && $level['id'] !='default'}
					<!--<div class="form-group">
						<label class="col-lg control-label">等级</label>
						<div class="col-sm-9 col-xs-12">
							{ife 'member.level' $level}
							<select  name="level" class="form-control tp_is_default" style="width:90px;">
								{loop $level_array $key $value}
								<option value="{$value}" {if $level['s_level_type']==$value}selected{/if}>{$value}</option>
								{/loop}
							</select>
							<span class='help-block'>数字越大等级越高</span>
							{else}
							<div class='form-control-static'>{$level['level']}</div>
							{/if}
						</div>
					</div>-->
				{/if}
                <div class="form-group">
                    <label class="col-sm-2 control-label must">等级名称</label>
                    <div class="col-sm-9 col-xs-12">
						{ife 'member.level' $level}
                        <input type="text" name="levelname" class="form-control" value="{$level['levelname']}" data-rule-required='true'/>
						{else}
						<div class='form-control-static'>{$level['levelname']}</div>
						{/if} 
                    </div>
                </div>
              	<div class="form-group">
                    <label class="col-sm-2 control-label must">等级级别</label>
                    <div class="col-sm-9 col-xs-12">
                        <select name='s_level_type' class="form-control select2">
							{php for($i=0;$i<=50;$i++):}
                            <option value="{$i}" {if $i == $level['s_level_type']}selected{/if}>{$i}</option>
							{php endfor}
                        </select>
                    </div>
                </div>
                {if $set['level']>=1}
                <div class="form-group">
                    <label class="col-sm-2 control-label">一级佣金比例</label>
                          <div class="col-sm-9 col-xs-12">
							{ife 'member.level' $level}
                                                            <div class='input-group'>
                        <input type="text" name="commission1" class="form-control" value="{$level['commission1']}" />
                            <div class='input-group-addon'>%</div>
                        </div>
						{else}
						<div class='form-control-static'>{$level['commission1']}%</div>
						{/if} 
                    </div>
                </div>
                {/if}
                  {if $set['level']>=2}
                <div class="form-group">
                    <label class="col-sm-2 control-label">二级佣金比例</label>
                         <div class="col-sm-9 col-xs-12">
                       {ife 'member.level' $level}
                       <div class='input-group'>
                        <input type="text" name="commission2" class="form-control" value="{$level['commission2']}" />
                        <div class='input-group-addon'>%</div>
                        </div>
						{else}
						<div class='form-control-static'>{$level['commission2']}%</div>
						{/if} 
                    </div>
                </div>
                    {/if}
                  {if $set['level']>=3}
                  <div class="form-group">
                    <label class="col-sm-2 control-label">三级佣金比例</label>
                          <div class="col-sm-9 col-xs-12">
                      {ife 'member.level' $level}
                          <div class='input-group'>
                        <input type="text" name="commission3" class="form-control" value="{$level['commission3']}" />
                          <div class='input-group-addon'>%</div>
                        </div>
						{else}
						<div class='form-control-static'>{$level['commission3']}%</div>
						{/if} 
                    </div>
                </div>
                    {/if}
              	<!--<div class="form-group">
                    <label class="col-sm-2 control-label">推荐返还奖</label>
                         <div class="col-sm-9 col-xs-12">
                       {ife 'member.level' $level}
                       <div class='input-group'>
                        <input type="text" name="recoreturn" class="form-control" value="{$level['recoreturn']}" />
                        <div class='input-group-addon'>元</div>
                        </div>
						{else}
						<div class='form-control-static'>{$level['recoreturn']}元</div>
						{/if} 
                    </div>
                </div>-->
                 <div class="form-group">
                    <label class="col-sm-2 control-label">级差奖(固定金额)</label>
                         <div class="col-sm-9 col-xs-12">
                       {ife 'member.level' $level}
                       <div class='input-group'>
                        <input type="text" name="unlimited" class="form-control" value="{$level['unlimited']}" />
                        <div class='input-group-addon'>元</div>
                        </div>
						{else}
						<div class='form-control-static'>{$level['range']}元</div>
						{/if} 
                    </div>
                </div>
				<div class="form-group">
					<label class="col-sm-2 control-label">级差奖(百分比)</label>
					<div class="col-sm-9 col-xs-12">
						{ife 'member.level' $level}
						<div class='input-group'>
							<input type="text" name="percentage" class="form-control" value="{$level['percentage']}" />
							<div class='input-group-addon'>%</div>
						</div>
						{else}
						<div class='form-control-static'>{$level['range']}元</div>
						{/if}
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">金额/百分比</label>
					<div class="col-sm-9 col-xs-12">
						{ifp 'commission.set.edit'}
						<label class="radio-inline"><input type="radio"  name="status" value="1" {if $level['status'] ==1} checked="checked"{/if} /> 固定金额</label>
						<label class="radio-inline"><input type="radio"  name="status" value="0" {if $level['status'] ==0} checked="checked"{/if} /> 百分比</label>
						<!--<span class='help-block'>开启之后则会从已返金额中部分则被公司从余额或之后收益中扣除</span>-->
						{else}
						{if $data['status'] ==0}关闭{else}开启{/if}
						{/if}
					</div>
				</div>
              	<div class="form-group">
                  <label class="col-sm-2 control-label">分销金额收入封顶</label>
                  <div class="col-sm-9 col-xs-12">
                    {ife 'member.level' $level}
                    <div class='input-group'>
                      <input type="text" name="copping" class="form-control" value="{$level['copping']}" />
                      <div class='input-group-addon'>元</div>
                    </div>
                    {else}
                    <div class='form-control-static'>{$level['copping']}元</div>
                    {/if}
                  </div>
         		</div>
					{if $level['id']!='default'}
                  <div class="form-group">
                    <label class="col-sm-2 control-label">升级条件</label>
                    <div class="col-sm-9 col-xs-12">
						    {ife 'member.level' $level}
                        <div class='input-group'>
							{if $leveltype==0}
									<span class='input-group-addon'>分销订单金额满</span>
									<input type="text" name="ordermoney" class="form-control" value="{$level['ordermoney']}" />
									<span class='input-group-addon'>元</span>
								 
							{/if}
							
							{if $leveltype==1}
									<span class='input-group-addon'>一级分销订单金额满</span>
									<input type="text" name="ordermoney" class="form-control" value="{$level['ordermoney']}" />
									<span class='input-group-addon'>元</span>
							{/if}
							 
							
							{if $leveltype==2}
									<span class='input-group-addon'>分销订单数量满</span>
									<input type="text" name="ordercount" class="form-control" value="{$level['ordercount']}" />
									<span class='input-group-addon'>个</span>
							{/if}
							
							{if $leveltype==3}
									<span class='input-group-addon'>一级分销订单数量满</span>
									<input type="text" name="ordercount" class="form-control" value="{$level['ordercount']}" />
									<span class='input-group-addon'>个</span>
							{/if}
							
							{if $leveltype==4}
									<span class='input-group-addon'>自购订单金额满</span>
									<input type="text" name="ordermoney" class="form-control" value="{$level['ordermoney']}" />
									<span class='input-group-addon'>元</span>
							{/if}
							
							{if $leveltype==5}
									<span class='input-group-addon'>自购订单数量满</span>
									<input type="text" name="ordercount" class="form-control" value="{$level['ordercount']}" />
									<span class='input-group-addon'>个</span>
							{/if}
							{if $leveltype==6}
									<span class='input-group-addon'>下级总人数满</span>
									<input type="text" name="downcount" class="form-control" value="{$level['downcount']}" />
									<span class='input-group-addon'>个（分销商+非分销商）</span>
							{/if}
							{if $leveltype==7}
									<span class='input-group-addon'>一级下级人数满</span>
									<input type="text" name="downcount" class="form-control" value="{$level['downcount']}" />
									<span class='input-group-addon'>个（分销商+非分销商）</span>
							{/if}
							{if $leveltype==8}
									<span class='input-group-addon'>团队总人数满</span>
									<input type="text" name="downcount" class="form-control" value="{$level['downcount']}" />
									<span class='input-group-addon'>个（分销商）</span>
							{/if}
							{if $leveltype==9}
									<span class='input-group-addon'>一级团队人数满</span>
									<input type="text" name="downcount" class="form-control" value="{$level['downcount']}" />
									<span class='input-group-addon'>个（分销商）</span>
							{/if}
							 
							{if $leveltype==10}
									<span class='input-group-addon'>已提现佣金总金额满</span>
									<input type="text" name="commissionmoney" class="form-control" value="{$level['commissionmoney']}" />
									<span class='input-group-addon'>元</span>
							{/if}

							{if $leveltype==11}
							<span class='input-group-addon'>购买指定产品</span>
								<div class="col-sm-9 col-xs-12" style="overflow: hidden">
									<?php echo tpl_selector('goodsids',array(
								     'preview'=>ture,
									'multi'=>1,
									'autosearch'=>0,
									'value'=>$item['title'],
									'url'=>webUrl('commission/goodsquery'),
									'items'=>$goods,
									'buttontext'=>'选择商品',
									'placeholder'=>'请选择商品')
									)
									?>

								</div>
							{/if}
                        </div>
						{if $leveltype==11}
						<span class='help-block'>购买上述任意商品即可，订单完成且过维权期才可升级
						最多可添加5件商品,如果商品在别的等级存在,则无法选择</span>
						{/if}
                        <span class='help-block'>分销商升级条件，不填写默认为不自动升级</span>
						{else}
						
						          {if $leveltype==0}
									 分销订单金额满 {$level['ordermoney']} 元
							{/if}
							
							{if $leveltype==1}
							                      一级分销订单金额满 {$level['ordermoney']} 元
							{/if}
							{if $leveltype==2}
							                    分销订单数量满 {$level['ordercount']} 个
							{/if}
							
							{if $leveltype==3}
							                一级分销订单数量满 {$level['ordercount']} 个
							{/if}
							
							{if $leveltype==4}
							       自购订单金额满 {$level['ordermoney']} 元
							 {/if}
							
							{if $leveltype==5}
							                   自购订单数量满 {$level['ordercount']} 个
							{/if}
							{if $leveltype==6}
							 下级总人数满 {$level['downcount']} 个（分销商+非分销商）
									 
							{/if}
							{if $leveltype==7}
							一级下级人数满 {$level['downcount']} 个（分销商+非分销商）
									 
							{/if}
							{if $leveltype==8}
								团队总人数满 {$level['downcount']} 个（分销商）
							{/if}
							{if $leveltype==9}
							          一级团队人数满 {$level['downcount']} 个（分销商）
							{/if}
							 
							{if $leveltype==10}
							          已提现佣金总金额满 {$level['commissionmoney']} 元
							{/if}
						
						{/if}
                    </div>
                </div>
					{/if}
                
               
            </div>
            <div class="modal-footer">
                <button class="btn btn-primary" type="submit">提交</button>
                <button data-dismiss="modal" class="btn btn-default" type="button">取消</button>
            </div>
        </div>
</form>
